import request from '@/utils/request'
import { upload } from '@/utils/request'
import axios from 'axios';

// 筛选参数
export interface SelectData {
    label: string;
    value: string | number | undefined;
}

// 文件信息
export interface FileInfo {
    fileName: string;
    fileUrl: string;
    filePath: string;
    type: string;
    size: string;
}

// 上传文件
export function uploadFile(file: File, params: any) {
    const formData = new FormData();
    formData.append('file', file);
    return upload<FileInfo>('/common/file/upload', formData)
}

// 获取字典数据
export function selectDict(params: string) {
    return request('get', '/common/dict/select/' + params)
}

// 获取角色数据
export function selectRole(params: any) {
    return request<SelectData[]>('get', '/common/role/select', { params })
}

// 获取岗位数据
export function selectPost(params: any) {
    return request<SelectData[]>('get', '/common/post/select', { params })
}

// 获取用户数据
export function selectSysUser(params: any) {
    return request<SelectData[]>('get', '/common/sys-user/select', { params })
}